package org.grow.problem.controller;

import org.grow.problem.entity.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * @Author: xwg
 * @CreateDate: 2022/5/16
 */

@Controller
//@RestController
@RequestMapping("/problem/tiny")
public class TinyController {

    @ResponseBody
    @GetMapping("/showtime")
    public LocalDateTime showtime() {
        System.out.println(LocalDateTime.now());
        return LocalDateTime.now();
    }
    @ResponseBody
    @PostMapping("/insert")
    public Student insert(@RequestBody Student student){
        System.out.println(student);
        student.setSex(true);
        return student;
    }
    @ResponseBody
    @PostMapping("/add/{name}/{sex}")
    public Student add(@PathVariable String name,@PathVariable Boolean sex){
        Student student = new Student(name, sex);
        System.out.println(student);
        return student;
    }
}
